<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/4/1
 * Time: 10:21
 */

namespace Home\Controller;


use Think\Controller;

class AccountController extends Controller
{
    /**
     * 登录
     */
    public function login(){
        if(IS_POST){
            $Corps = D('Corps');
            $phone = $_POST['phone'];
            $password = $_POST['password'];
            $corps = $Corps->where("telephone='$phone' and password='$password'")->find();
            if($corps){
                session('loginuser',$corps);
                $this->success("成功",U('Corps/index'));
            }
            else{
                $this->error("登录失败");
            }
        }
        $this->display();
    }

}